﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Threading;
using BaseCardTypes = Wormhole.Engine.CardLibrary.BaseCardTypes;
using CardProperties = Wormhole.Engine.CardLibrary.CardProperties;
using CardTypes = Wormhole.Engine.CardLibrary.CardTypes;
using System.Windows.Media;

namespace Wormhole.UI.Application.Controls.Cards
{
	/// <author>Hannes Foulds</author>
	/// <date>04 November 2008</date>
	/// <summary>
	/// This control is used to display an adversary card.
	/// </summary>
	public class AdversaryCard : Card
	{
		#region Constructor
		/// <summary>
		/// Initialize a default instance of the class.
		/// </summary>
		public AdversaryCard()
			: base()
		{
		}

		/// <summary>
		/// Create a new instance of the control to render the specific card.
		/// </summary>
		/// <param name="card">The engine card that should be rendered.</param>
		public AdversaryCard(BaseCardTypes.Card card)
			: base(card)
		{
		}
		#endregion

		#region Set Size
		/// <summary>
		/// Set the card size.
		/// </summary>
		protected override void SetSize()
		{
			this.cardImage.Width = 131 * 0.7;
			this.cardImage.Height = 121 * 0.7;
			this.cardImage.Stretch = Stretch.Fill;

			this.outsideBorder.Width = this.cardImage.Width + 10;
			this.outsideBorder.Height = this.cardImage.Height + 10;

			this.Width = this.outsideBorder.Width;
			this.Height = this.outsideBorder.Height;
		}
		#endregion

		#region Display Status
		/// <summary>
		/// Draw a border around the card if it can be assigned to the current mission.
		/// </summary>
		public override void DisplayStatus()
		{
			base.DisplayStatus();

			CardTypes.Adversary card = this.EngineCard as CardTypes.Adversary;

			if (this.EngineCard.InputStatus == BaseCardTypes.InputStatus.AllowAssign)
			{
				if (card != null)
				{
					if (card.CanAssign())
						this.glowEffect.Opacity = 1;
					else
						this.glowEffect.Opacity = 0;
				}
			}
		}
		#endregion

	}
}
